<template>
  <div>
    <div v-if="page_type !== 'show'">
      <right>
        <el-button-group>
          <el-button size="mini" @click="add">新增</el-button>
        </el-button-group>
      </right>
    </div>
    <elm-table :data='reims' :stripe='true' :border='true' size='mini'
               style="width: 99.9%; min-height: 300px" :page-size="9999">
      <el-table-column label="费用科目" align="center">
        <template v-slot="scope">
          <elm-select url="/business/my/GetCostTypeData" v-model="scope.row.col_1" placeholder="请选择"
                      key-name="name" label-name="name" value-name="name" size="mini">
          </elm-select>
        </template>
      </el-table-column>
      <el-table-column label="发票类型" align="center">
        <template v-slot="scope">
          <elm-code dict_type="bms_invoice_lx" v-model="scope.row.col_2" size="mini"></elm-code>
        </template>
      </el-table-column>
      <el-table-column label="发票张数" align="center">
        <template v-slot="scope">
          <el-input v-model="scope.row.col_7" size="mini"></el-input>
        </template>
      </el-table-column>
      <el-table-column label="票面金额" align="center">
        <template v-slot="scope">
          <el-input v-model="scope.row.col_4" size="mini"></el-input>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="180px" fixed="right" align="center">
        <template v-slot="scope">
          <el-button @click="del(scope.row)" type="text" size="mini" >
            删除</el-button>
        </template>
      </el-table-column>
    </elm-table>
  </div>
</template>

<script>
export default {
    data() {
        return {
          reims: [],
        }
    },
    model: {
        prop: 'value',
        event: 'change'
    },
    props: {
      biz_id: {
        type: String,
        default: null
      },
      page_type: {
        type: String,
        default: 'create'
      },
    },
    watch: {
    },
    created() {
      this.loadData();
    },
    methods: {
      async loadData() {
        let res = await elm.post('/system/login/flow/GetFWComSub', {biz_id: this.biz_id});
        this.reims = res;
      },
      add() {
        this.reims.push({biz_id: this.biz_id, col_1:'', col_2:'', col_7:'', col_4:''});
      },
      async del(item)
      {
        this.reims = this.reims.filter(p => !(p==item));
      }
    }
}
</script>
<style scoped>
</style>